home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / UTILITY2 / RFDML120.ZIP / TDC.SCR < prev    next >
Text File  |  1994-01-19  |  14KB  |  518 lines

  1. ;------------------------------------------------------
  2. ;TDC.SCR --- The script file for TDC (dircon.co.uk)
  3. ;------------------------------------------------------
  4. ;   We begin with the format specifiers to which allow
  5. ;the script to identify where the MailId, RealName,
  6. ;and Subject texts are in a newly downloaded letter.
  7. ;
  8. Format
  9. Subject: $SUBJECT$\n
  10. Subj: $SUBJECT$\n
  11. From: "$NAME$" <$UID$>\n
  12. From: ""$NAME$"" <$UID$>\n
  13. From: $NAME$<$UID$>\n
  14. From: $UID$ ($NAME$)\n
  15. From: $UID$ \n
  16. From: $UID$\n
  17. Endformat
  18. ;------------------------------------------------------
  19. ;   Next is a set of aliases which determine various
  20. ; items such as where some of the standard commands
  21. ; like '/usr/ucb/mail' live.
  22. ;
  23. Alias shellstart 'go ksh'
  24. Alias sendmail 'mail '
  25. Alias readmail 'mail'
  26. Alias saveletter 's '
  27. Alias deleteletter 'd '
  28. Alias quitmail 'q'
  29. Alias mailnull '#'
  30. Alias mailshellesc '!'
  31. Alias rm '/bin/rm -f '
  32. Alias echo '/bin/echo '
  33. Alias cat '/bin/cat '
  34. Alias logoff 'off'
  35. ;------------------------------------------------------
  36. ; The following aliases determine the various prompts the
  37. ; script will look for.
  38. ;
  39. Alias menuprompt ' -> '
  40. Alias prompt '\n$ '
  41. Alias mailprompt '\n& '
  42. Alias subjectprompt '\nSubject: '
  43. Alias ccprompt1 'Cc:'
  44. Alias ccprompt2 'CC:'
  45. Alias ccprompt3 'cc:'
  46. Alias loginprompt 'login: '
  47. Alias passwdprompt 'assword:'
  48. Alias havemailprompt 'message'
  49. Alias nomailprompt 'No mail'
  50. ;
  51. ; If you want to append your ~/.signature file to every outgoing
  52. ; message, set the following alias to SEND_SIG, otherwise set it
  53. ; to NO_SIGNATURE:
  54. ;
  55. Alias signature NO_SIGNATURE
  56. ;
  57. ;------------------------------------------------------
  58. ; The following aliases determine what the script will look
  59. ; for to determine that we've successfully logged in
  60. ; (banner1-2), and what it will look for to determine that
  61. ; we've successfully logged out (logoffbanner1-2)
  62. ;
  63. Alias banner1 'The Direct Connection'
  64. Alias banner2 '\nLast login:'
  65. Alias logoffbanner1 %loginprompt%
  66. Alias logoffbanner2 'closed'
  67. ;------------------------------------------------------
  68. ; The following alias should be set TRUE if your modem
  69. ; drops carrier every time you make a connection.  This
  70. ; alias simply forces the script to wait 2 seconds for
  71. ; the connection to settle before starting the script.
  72. ;
  73. Alias waitasec FALSE
  74. ;
  75. ;------------------------------------------------------
  76. ; The following aliases determine the command to use for
  77. ; downloading, and the prompt the upload program will send
  78. ; when it's ready to send data.  Comment these out if
  79. ; you don't want to use ZMODEM:
  80. ;
  81. Alias sz 'sz '
  82. Alias szprompt1 '\n**'
  83. Alias dnloadproto ZMODEM
  84. ;
  85. ; Uncomment the following aliases if you want to use YMODEM
  86. ; as your download protocol:
  87. ;
  88. ;Alias sz 'sb '
  89. ;Alias szprompt1 '\nsb: 1 file'
  90. ;Alias dnloadproto YMODEM
  91. ;
  92. ; Uncomment the following aliases if you want to use XMODEM
  93. ; as your download protocol:
  94. ;
  95. ;Alias sz 'sx '
  96. ;Alias szprompt1 'command now.'
  97. ;Alias dnloadproto XMODEM
  98. ;
  99. ;------------------------------------------------------
  100. ; The following aliases determine the command to use for
  101. ; uploading, and the prompt the upload program will send
  102. ; when it's ready to receive data.  Comment these out if
  103. ; you don't want to use ZMODEM:
  104. ;
  105. Alias rz 'rz -a '
  106. Alias rzprompt1 'to your modem  '
  107. Alias rzprompt2 'ready'
  108. Alias uploadproto ZMODEM
  109. ;
  110. ; Uncomment the following aliases if you want to use YMODEM
  111. ; as your upload protocol:
  112. ;
  113. ;Alias rz 'rb -a '
  114. ;Alias rzprompt1 'to your modem'
  115. ;Alias rzprompt2 'ready'
  116. ;Alias uploadproto YMODEM
  117. ;
  118. ; Uncomment the following aliases if you want to use XMODEM
  119. ; as your upload protocol:
  120. ;
  121. ;Alias rz 'rx -ac '
  122. ;Alias rzprompt1 'to your modem'
  123. ;Alias rzprompt2 'ready to receive'
  124. ;Alias uploadproto XMODEM
  125. ;
  126. ; Uncomment the following aliases if you want to use KERMIT
  127. ; as your upload protocol:
  128. ;
  129. ;Alias rz 'kermit -e 256 -r '
  130. ;Alias rzprompt1 'READY TO RECEIVE'
  131. ;Alias rzprompt2 'ready to receive'
  132. ;Alias uploadproto KERMIT
  133. ;
  134. ;------------------------------------------------------
  135. ; This is the main entry-point for the script, which
  136. ; decides which intermediate network will be used to
  137. ; connect to the host.
  138. ;
  139. Begin START
  140.    If %waitasec% Then WAIT_START
  141.    If TRUE Then DIRECT
  142. End
  143. Begin WAIT_START
  144.    Timeout 2 Goto DIRECT
  145. End
  146. ;------------------------------------------------------
  147. ; This is the entry-point for The Direct Connection
  148. ; host.  This state merely sends CR's every three
  149. ; seconds until it sees a login prompt.
  150. ;
  151. Begin DIRECT
  152.    Caption 'login: '
  153.    Cr
  154.    When %loginprompt% Goto USERNAME
  155.    Timeout 3 Goto START
  156. End
  157. ;------------------------------------------------------
  158. ; At this point we've seen the host's login prompt, and
  159. ; are attempting to log in.
  160. ;
  161. Begin USERNAME
  162.    Transmit $USERNAME
  163.    Cr
  164.    When %passwdprompt% Goto PASSWORD
  165.    When %loginprompt% Goto USERNAME
  166.    Timeout 120 Goto NO_LOGIN
  167. End
  168. Begin PASSWORD
  169.    Transmit $PASSWORD
  170.    Cr
  171.    When %passwdprompt% Goto PASSWORD
  172.    When %loginprompt% Goto USERNAME
  173.    When %banner1% Goto LOGGED_IN
  174.    When %banner2% Goto LOGGED_IN
  175.    When %menuprompt% Goto GO_TO_SHELL
  176.    When %prompt% Goto JUMP_TO_MAIL
  177.    Timeout 120 Goto NO_LOGIN
  178. End
  179. Begin LOGGED_IN
  180.    Caption 'logged in'
  181.    When %menuprompt% Goto GO_TO_SHELL
  182.    When %prompt% Goto JUMP_TO_MAIL
  183.    Timeout 120 Goto NO_LOGIN
  184. End
  185. Begin GO_TO_SHELL
  186.    Caption 'Starting a Shell'
  187.    Transmit %shellstart%
  188.    Cr
  189.    When %prompt% Goto JUMP_TO_MAIL
  190.    Timeout 120 Goto NO_LOGIN
  191. End
  192. ;------------------------------------------------------
  193. ; These states check to see if there is any mail waiting
  194. ; by running the host's mail program and looking for
  195. ; keywords indicating the presence/absence of mail.
  196. ; If there's mail (and the script is in fetch mode),
  197. ; then the FETCH_FROM_MAIN_MENU sequence is started.
  198. ; If there's no mail, but there are letters to send,
  199. ; the SEND_MAIL sequence is started.  Otherwise the
  200. ; script just logs off.
  201. ;
  202. Begin JUMP_TO_MAIL
  203.    Transmit %readmail%
  204.    Cr
  205.    When %nomailprompt% Goto NO_MAIL_WAITING
  206.    When %havemailprompt% Goto MAIL_WAITING
  207.    Timeout 10 Goto RETRY_JUMP
  208. End
  209. Begin RETRY_JUMP
  210.    Transmit %readmail%
  211.    Cr
  212.    When %nomailprompt% Goto NO_MAIL_WAITING
  213.    When %havemailprompt% Goto MAIL_WAITING
  214.    Timeout 15 Goto GIVE_UP
  215. End
  216. Begin NO_MAIL_WAITING
  217.    Caption 'No Mail'
  218.    If MORE_LETTERS Then SEND_MAIL
  219.    When %prompt% Goto LOG_OFF
  220.    Timeout 15 Goto GIVE_UP
  221. End
  222. Begin MAIL_WAITING
  223.    Caption 'You Have Mail'
  224.    If FETCHING Then FETCH_FROM_MAIN_MENU
  225.    If MORE_LETTERS Then SEND_BUT_QUIT
  226.    When %mailprompt% Goto QUIT_MAIL
  227.    Timeout 120 Goto LOG_OFF
  228. End
  229. Begin QUIT_MAIL
  230.    Transmit %quitmail%
  231.    Cr
  232.    When %mailprompt% Goto QUIT_MAIL
  233.    When %prompt% Goto LOG_OFF
  234.    Timeout 15 Goto GIVE_UP
  235. End
  236. Begin SEND_BUT_QUIT
  237.    Transmit %quitmail%
  238.    Cr
  239.    When %mailprompt% Goto SEND_BUT_QUIT
  240.    When %prompt% Goto REQUEST_UPLOAD_LETTER
  241.    Timeout 15 Goto GIVE_UP
  242. End
  243. ;------------------------------------------------------
  244. ; These states execute for each letter to be downloaded.
  245. ; They save the letter to the mail.tmp file, download
  246. ; the file, instruct RFD to put the letter in the In Box,
  247. ; delete the letter on the host, then check for more mail.
  248. ;
  249. Begin FETCH_FROM_MAIN_MENU
  250.    When %mailprompt% Goto PRESERVE_MAIL
  251.    Timeout 10 Goto PRESERVE_MAIL
  252. End
  253. Begin PRESERVE_MAIL
  254.    Transmit 'preserve *'
  255.    Cr
  256.    ClearIndex
  257.    When %mailprompt% Goto DEL_TMPFILE
  258.    Timeout 20 Goto DEL_TMPFILE
  259. End
  260. Begin DEL_TMPFILE
  261.    Transmit %mailshellesc%
  262.    Transmit %rm%
  263.    Transmit $LETTER.FILENAME
  264.    Cr
  265.    NextIndex
  266.    When %mailprompt% Goto SAVE_CURLETTER
  267.    Timeout 20 Goto SAVE_CURLETTER
  268. End
  269. Begin SAVE_CURLETTER
  270.    Transmit %saveletter%
  271.    Transmit $INDEX
  272.    Transmit ' '
  273.    Transmit $LETTER.FILENAME
  274.    Cr
  275.    When 'New file' Goto REQUEST_DOWNLOAD
  276.    When 'No messages' Goto NO_MORE_MAIL
  277.    When 'Invalid message' Goto NO_MORE_MAIL
  278.    Timeout 10 Goto REQUEST_DOWNLOAD
  279. End
  280. Begin REQUEST_DOWNLOAD
  281.    Caption 'Fetching Mail'
  282.    Transmit %mailshellesc%